﻿namespace EcmaDoc.Core.Configuration
{
	using System;
	using System.Xml;

	/// <summary>
	/// Represents a link to an external type, as defined in the parser configuration.
	/// </summary>
	internal class LinkInfo
	{
		/// <summary>
		/// Initializes a new instance of the <see cref="LinkInfo"/> class using the specified <paramref name="infoElement"/>.
		/// </summary>
		/// <param name="infoElement">The configuration element that contais the link data.</param>
		public LinkInfo(XmlElement infoElement)
		{
			if (infoElement == null)
				throw new ArgumentNullException("infoElement");

			this.Name = infoElement.GetAttribute("name");
			this.Url = infoElement.InnerText;
		}

		/// <summary>
		/// Gets the name of this link.
		/// </summary>
		public string Name
		{
			get;
			private set;
		}

		/// <summary>
		/// Gets the URL of this link.
		/// </summary>
		public string Url
		{
			get;
			private set;
		}
	}
}
